<admintpl file="header" />
	<style>
		.center {
			text-align: center!important;
		}

		.select_area {
			width: 120px!important;
			height: 1.5rem;
			line-height: .2rem;
			display: inline-block;
			color: #707070;
			font-size: .14rem;
			padding: .05rem .08rem;
			border: 1px solid #707070;
			letter-spacing: .02rem;
			border-radius: .1rem;
			margin: 0 .07rem;
			margin-bottom: .1rem;
		}
	</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="javascript:;">活动列表</a></li>
			<li><a href="{:U('Activity/Adminactivity/edit')}">添加活动</a></li>
		</ul>
		<form class="well form-search" method="post" action="{:U('Activity/Adminactivity/lists')}">
            名称：
            <input type="text" name="name" style="width: 150px;" value="{$name|default=''}">
			城市：
			<div id="areaInfo" style="display: inline-block;">
				<input type="hidden" name="city_id">
			</div>
			时间：
			<input type="date" name="start_time" value="{$start_time|default=''}"> ~
			<input type="date" name="end_time" value="{$end_time|default=''}">

			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:U('Activity/Adminactivity/lists')}">清空</a>
		</form>


		<form class="js-ajax-form" action="" method="post">
			<table class="table table-hover table-bordered table-list">
				<thead>
					<tr>
						<th width="50">排序</th>
						<th width="50">ID</th>
						<th>名称</th>
						<th width="100">城市</th>
						<th width="100">活动形式</th>
                        <th width="100">订单</th>
						<th width="100">兑换码</th>
						<th width="150">开始时间</th>
						<th width="150">结束时间</th>
						<th width="70">操作</th>
					</tr>
				</thead>
				<foreach name="lists" item="vo">
				<tr>
					<td><input data-id="{$vo.id}" class="input input-order" type="text" size="5" value="{$vo.sort}"></td>
                    <td>{$vo.id}</td>
					<td>{$vo.name}</td>
					<td>{$vo.city_name}</td>
					<td>{$vo.act_form_name}</td>
                    <td><a href="{:U('Activity/Adminactivity/order_lists', array('id' => $vo['id']))}">查看订单（{$vo.order_count}）</a></td>
					<td>{$vo.ticket_code}</td>
					<td>{$vo.start_time}</td>
					<td>{$vo.end_time}</td>
					<td>
						<a href="{:U('Activity/Adminactivity/edit',array('id'=>$vo['id']))}">编辑</a> |
						<a href="{:U('Activity/Adminactivity/edit',array('id'=>$vo['id'], 'del' => 1))}" class="js-ajax-delete">删除</a>
					</td>
				</tr>
				</foreach>
			</table>
			<div class="pagination">{$page}</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script src="__PUBLIC__/js/area.js"></script>
	<script>
        var area = {$area};
        area = eval(area);

        var areaPath = {$path ? $path : []};
        areaPath = eval(areaPath);

        $(function () {
            // 地址选择select的初始化
            initArea(2);
        })
	</script>

	<script>
        $(document).ready(function () {
            $('body').delegate('.input-order', 'change', function () {
                var order 	= $(this).val();
                var id 		= $(this).attr('data-id');
                $.get("{:U('Activity/Adminactivity/change_acitvity_sort')}", {id : id, order : order}, function (data) {
                    if (data.status) {
                        window.location.reload();
                    }
                })
            })
        })
	</script>
</body>
</html>